#include <cstdio>
#define max 100000
int parent[max];

void ufset(int n)
{
    for (int i=1;i<=n;parent[i++]=-1);
}

int find(int x)
{
    int s;
    for (s=x;parent[s]>=0;s=parent[s]);
    while (s != x)
    {
        int tmp;
        tmp=parent[x];
        parent[x]=s;
        x=tmp;
    }
    return s;
}

void merge(int u,int v)
{
    int r1=find(u),r2=find(v);
    int tmp=parent[r1]+parent[r2];
    if (parent[r1]<parent[r2])
    {
        parent[r1]=tmp;
        parent[r2]=r1;
    }
    else
    {
        parent[r2]=tmp;
        parent[r1]=r2;
    }
}

int main()
{
    int
    while (scanf("%d%d",&n,&m))
    {
        int flag=1;
        if (n == 0 && m == 0)   break;

    }

}
